FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ProjectManApi/ProjectManApi.csproj", "ProjectManApi/"]
COPY ["BusinessCache/BusinessCache.csproj", "BusinessCache/"]
COPY ["Businessutil/Businessutil.csproj", "Businessutil/"]
COPY ["BusinessRule/BusinessRule.csproj", "BusinessRule/"]
COPY ["BusinessEntity/BusinessEntity.csproj", "BusinessEntity/"]
COPY ["BusinessResp/BusinessRepository.csproj", "BusinessResp/"]
COPY ["EurekaService/BEurekaService.csproj", "EurekaService/"]
COPY ["BConsulService/BConsulService.csproj", "BConsulService/"]
RUN dotnet restore "ProjectManApi/ProjectManApi.csproj"
COPY . .
WORKDIR "/src/ProjectManApi"
RUN dotnet build "ProjectManApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "ProjectManApi.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ProjectManApi.dll"]